package ws.mizera.android.yaca;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;

public class Cars extends ListActivity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
	  super.onCreate(savedInstanceState);

	  String[] auta = getResources().getStringArray(R.array.cars_array);
	  setListAdapter(new ArrayAdapter<String>(this, R.layout.lists, auta));

	  ListView lv = getListView();
	  lv.setTextFilterEnabled(true);

	  lv.setOnItemClickListener(new OnItemClickListener() {
	    public void onItemClick(AdapterView<?> parent, View view,
	        int position, long id) {
	    	
	    	Intent intent;
	    	intent = new Intent().setClass(Cars.this, AddCar.class);
	    	startActivity(intent);
	    }
	  });
	}
	
}